package com.xoa.controller.cms;

import com.xoa.service.cms.CmsSitePublishService;
import com.xoa.util.common.wrapper.BaseWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
* @author 程叶同
* @date 2018/7/12 13:31
* @desc 全站点发布
*/
@Controller
@RequestMapping("/cmsSitePub")
public class CmsSitePubController {
    @Autowired
private CmsSitePublishService sitePublishService;
    /**
     * 全站点发布
     * @param request
     * @param response
     */
    @ResponseBody
    @RequestMapping("/toPub")
    public BaseWrapper toPub(HttpServletRequest request, HttpServletResponse response, Integer siteId){
       BaseWrapper baseWrapper=new BaseWrapper();
        try {
            sitePublishService.toPub(request,siteId,true);
            baseWrapper.setFlag(true);
            baseWrapper.setStatus(true);
            baseWrapper.setMsg("发布成功");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return baseWrapper;
    }

}
